*Mastercode
*define directory
local where /replication_files

set more off
clear all



cd "`where'/data"

mkdir output


foreach j in comparingwords foundtopics {
	run "`where'/subcode/appendix_`j'.do"
}


*
run "`where'/subcode/step0_collapsing_topic_shares.do"

*
run "`where'/subcode/step1_compute_predictions.do"

*
run "`where'/subcode/step2_compute_roc.do"

*
run "`where'/subcode/step3_notalltopics.do"

*
run "`where'/subcode/step4_lasso.do"




foreach j in robust_bdhigh bdbest wardshort robustness logit twobefore prepareonlyintersection prepareonlyintersection_nofe {
	run "`where'/subcode/appendix_`j'.do"
}


*create figures 

foreach j in 1 2 4 5 6 7 8 E2_E4_robust E5 E6 E7 E10 E13 E14 E15 E16 E18 I1 I4 {
	quietly run "`where'/subcode/fig`j'.do"
}

*In order to create figure E19 one has to run the matlab code neural_networks_loop.m first
* E19


*create tables
foreach j in H1 G2_G3 {
	quietly run "`where'/subcode/table`j'.do"
}


*delete extra files
foreach j in blub temp tempx blub1 blub2 tempo tempt main_temp {
	cap erase `j'.dta
	cap erase output/`j'.dta
}
